Public Class PhanSo
    Protected tu As Integer
    Protected mau As Integer
    'cac ham property
    Property _tu() As Integer
        Get
            Return Me.tu
        End Get
        Set(ByVal value As Integer)
            Me.tu = value
        End Set
    End Property
    Property _mau() As Integer
        Get
            Return Me.mau
        End Get
        Set(ByVal value As Integer)
            Me.mau = value
        End Set
    End Property
    'ham khoi tao
    Public Sub New()
        Me.tu = 0
        Me.mau = 1
    End Sub
    'nhap
    Public Shared Function Nhap() As PhanSo
        Dim ps As New PhanSo
        Console.Write("nhap tu: ")
        ps.tu = Integer.Parse(Console.ReadLine())
        Console.Write("nhap mau: ")
        ps.mau = Integer.Parse(Console.ReadLine())
        Return ps
    End Function
    'xuat
    Public Sub Xuat()
        Console.WriteLine("Phan so la: {0}/{1}", Me.tu, Me.mau)
    End Sub
    'tong
    Public Function Tong(ByVal ps As PhanSo) As PhanSo
        Dim kq As New PhanSo
        kq.tu = Me.tu * ps.mau + Me.mau * ps.tu
        kq.mau = Me.mau * ps.mau
        Return kq
    End Function

End Class
